package com.franklin.java.configuration.sql.completion;

import com.franklin.java.api.state.BasePersistentState;
import com.franklin.java.api.state.BaseProjectPersistentState;
import com.intellij.execution.ui.layout.Tab;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StoragePathMacros;
import com.intellij.openapi.project.Project;

/**
 * 表名前缀持久化
 * @author Franklin
 * @since 2021/9/1 17:31
 */
@State(name = "com.franklin.java.configuration.sql.completion.TableNamePrefixState",
    storages = {@Storage(StoragePathMacros.WORKSPACE_FILE)})
public class TableNamePrefixState extends BaseProjectPersistentState<TableNamePrefixState> {
    
    public String prefix = "fly";

    public TableNamePrefixState(Project myProject) {
        super(myProject);
    }

    public static TableNamePrefixState getInstance(Project project){
        return project.getService(TableNamePrefixState.class);
    }

    public TableNamePrefixState() {
    }

    public static String getPrefix(Project project){
        return getInstance(project).prefix;
    }
}
